home *** CD-ROM | disk | FTP | other *** search
- unit fEditVersion;
-
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- StdCtrls, Buttons, ExtCtrls, uBuildingObject, uRCBuilder;
-
- type
- Tf_editversion = class(TForm)
- Label1: TLabel;
- Label2: TLabel;
- Label3: TLabel;
- Label4: TLabel;
- Label6: TLabel;
- Label13: TLabel;
- Label5: TLabel;
- Label7: TLabel;
- Label8: TLabel;
- Label9: TLabel;
- Label11: TLabel;
- Label12: TLabel;
- Label14: TLabel;
- Label15: TLabel;
- Label16: TLabel;
- Panel1: TPanel;
- Label18: TLabel;
- Label10: TLabel;
- Label19: TLabel;
- Label20: TLabel;
- Label21: TLabel;
- Label22: TLabel;
- L_nameOfExe: TLabel;
- BitBtn1: TBitBtn;
- BitBtn2: TBitBtn;
- L_nameOfBuildProject: TLabel;
- Label23: TLabel;
- E_Major : TEdit;
- E_Minor : TEdit;
- E_Release : TEdit;
- E_Build : TEdit;
- E_AppID : TEdit;
- E_ProductMajor : TEdit;
- E_ProductMinor : TEdit;
- E_ProductRelease : Tedit;
- E_ProductBuild : TEdit;
- E_Company : TEdit;
- E_Description : TEdit;
- E_Comments : TEdit;
- E_InternalName : TEdit;
- E_OriginalFilename : TEdit;
- E_CopyRight : TEdit;
- E_ProductName : TEdit;
- E_Trademark : TEdit;
- E_IconFilename : TEdit;
- E_SMajor : TEdit;
- E_SMinor : TEdit;
- E_SRelease : TEdit;
- E_SBuild : TEdit;
- E_SAppID : TEdit;
- E_SProductMajor : TEdit;
- E_SProductMinor : TEdit;
- E_SProductRelease : Tedit;
- E_SProductBuild : TEdit;
- E_SCompany : TEdit;
- E_SDescription : TEdit;
- E_SComments : TEdit;
- E_SInternalName : TEdit;
- E_SOriginalFilename : TEdit;
- E_SCopyRight : TEdit;
- E_SProductName : TEdit;
- E_STrademark : TEdit;
- E_SIconFilename : TEdit;
- b_iconFileName: TBitBtn;
- b_SIconFileName: TBitBtn;
- OpenDialog: TOpenDialog;
- m_merge: TMemo;
- procedure FormCreate(Sender: TObject);
- procedure BitBtn2Click(Sender: TObject);
- procedure b_iconFileNameClick(Sender: TObject);
- procedure E_majorKeyPress(Sender: TObject; var Key: Char);
- procedure E_majorChange(Sender: TObject);
- procedure E_descriptionChange(Sender: TObject);
- private
- fProjectName: string;
- fFileName: string;
- fBuilder: TBuilderClass;
- fRC : TResourceHandler;
- procedure SetFileName(const Value: string);
- procedure setProjectName(const Value: string);
- { Private declarations }
- public
- constructor EditSavings(aBuilder : TBuilderClass; const aProjectName, aFileName : string);
- Procedure RetrieveSettings;
- Procedure SaveSettings;
-
- Property Builder : TBuilderClass read fBuilder write fBuilder;
- Property ProjectName : string read fProjectName write setProjectName;
- Property FileName : string read fFileName write SetFileName;
-
- end;
-
- var
- f_editversion: Tf_editversion;
-
- implementation
- uses uSelectDir, fMainForm;
- {$R *.DFM}
-
- { TF_EditVersion }
-
- constructor Tf_editversion.EditSavings(aBuilder : TBuilderClass; const aProjectName,
- aFileName: string);
- begin
- inherited create(application);
- fBuilder := aBuilder;
- fRC := fBuilder.ResourceHandler;
- fBuilder.ProjectName := aProjectName;
- FileName := afileName;
- end;
-
- procedure Tf_editversion.RetrieveSettings;
- begin
- fBuilder.ResourceHandler.clearSettings;
- FBuilder.ResourceHandler.GetSettings(SlashSep(fBuilder.projectdir,cProjectList), rsProject );
- L_nameOfBuildProject.caption := f_mainForm.MakeEllipsisFilename(fBuilder.ProjectDir, L_nameOfBuildProject.Width, L_nameOfBuildProject.canvas);
- with FBuilder.ResourceHandler do begin
- E_Major.text := VersionInfo[reMajor];
- E_Minor.text := VersionInfo[reMinor];
- E_Release.text := VersionInfo[reRelease];
- E_Build.text := VersionInfo[reBuild];
- E_AppID.text := VersionInfo[reAppID];
- E_ProductMajor.text := VersionInfo[reProductMajor];
- E_ProductMinor.text := VersionInfo[reProductMinor];
- E_ProductRelease.text := VersionInfo[reProductRelease];
- E_ProductBuild.text := VersionInfo[reProductBuild];
- E_Company.text := VersionInfo[reCompany];
- E_Description.text := VersionInfo[reDescription];
- E_Comments.text := VersionInfo[reComments];
- E_InternalName.text := VersionInfo[reInternalName];
- E_OriginalFilename.text := VersionInfo[reOriginalFilename];
- E_CopyRight.text := VersionInfo[reLegalCopyRight];
- E_ProductName.text := VersionInfo[reProductName];
- E_Trademark.text := VersionInfo[reLegalTrademarks];
- e_IconFilename.text := VersionInfo[reIconFilename];
- end;
- fBuilder.ResourceHandler.clearSettings;
- FBuilder.ResourceHandler.GetSettings(ChangeFileExt(FileName, '.VER'), rsFile);
- L_nameOfExe.caption := f_mainForm.MakeEllipsisFilename(FileName, L_nameOfExe.Width, L_nameOfExe.canvas);
- with FBuilder.ResourceHandler do begin
- E_SMajor.text := VersionInfo[reMajor];
- E_SMinor.text := VersionInfo[reMinor];
- E_SRelease.text := VersionInfo[reRelease];
- E_SBuild.text := VersionInfo[reBuild];
- E_SAppID.text := VersionInfo[reAppID];
- E_SProductMajor.text := VersionInfo[reProductMajor];
- E_SProductMinor.text := VersionInfo[reProductMinor];
- E_SProductRelease.text := VersionInfo[reProductRelease];
- E_SProductBuild.text := VersionInfo[reProductBuild];
- E_SCompany.text := VersionInfo[reCompany];
- E_SDescription.text := VersionInfo[reDescription];
- E_SComments.text := VersionInfo[reComments];
- E_SInternalName.text := VersionInfo[reInternalName];
- E_SOriginalFilename.text := VersionInfo[reOriginalFilename];
- E_SCopyRight.text := VersionInfo[reLegalCopyRight];
- E_SProductName.text := VersionInfo[reProductName];
- E_STrademark.text := VersionInfo[reLegalTrademarks];
- E_SIconFilename.text := VersionInfo[reIconFilename];
- end;
-
-
-
- end;
-
- procedure Tf_editversion.SaveSettings;
- begin
- fBuilder.ResourceHandler.clearSettings;
- with FBuilder.ResourceHandler do begin
- VersionInfo[reMajor] := E_Major.text;
- VersionInfo[reMinor] := E_Minor.text;
- VersionInfo[reRelease] := E_Release.text;
- VersionInfo[reBuild] := E_Build.text;
- VersionInfo[reAppID] := E_AppID.text;
- VersionInfo[reProductMajor] := E_ProductMajor.text;
- VersionInfo[reProductMinor] := E_ProductMinor.text;
- VersionInfo[reProductRelease] := E_ProductRelease.text;
- VersionInfo[reProductBuild] := E_ProductBuild.text;
- VersionInfo[reCompany] := E_Company.text;
- VersionInfo[reDescription] := E_Description.text;
- VersionInfo[reComments] := E_Comments.text;
- VersionInfo[reInternalName] := E_InternalName.text;
- VersionInfo[reOriginalFilename] := E_OriginalFilename.text;
- VersionInfo[reLegalCopyRight] := E_CopyRight.text;
- VersionInfo[reProductName] := E_ProductName.text;
- VersionInfo[reLegalTrademarks] := E_Trademark.text;
- VersionInfo[reIconFilename] := E_IconFilename.text;
- SaveSettings(SlashSep(fBuilder.projectdir,cProjectList));
- end;
- fBuilder.ResourceHandler.clearSettings;
- with FBuilder.ResourceHandler do begin
- VersionInfo[reMajor] := E_SMajor.text;
- VersionInfo[reMinor] := E_SMinor.text;
- VersionInfo[reRelease] := E_SRelease.text;
- VersionInfo[reBuild] := E_SBuild.text;
- VersionInfo[reAppID] := E_SAppID.text;
- VersionInfo[reProductMajor] := E_SProductMajor.text;
- VersionInfo[reProductMinor] := E_SProductMinor.text;
- VersionInfo[reProductRelease] := E_SProductRelease.text;
- VersionInfo[reProductBuild] := E_SProductBuild.text;
- VersionInfo[reCompany] := E_SCompany.text;
- VersionInfo[reDescription] := E_SDescription.text;
- VersionInfo[reComments] := E_SComments.text;
- VersionInfo[reInternalName] := E_SInternalName.text;
- VersionInfo[reOriginalFilename] := E_SOriginalFilename.text;
- VersionInfo[reLegalCopyRight] := E_SCopyRight.text;
- VersionInfo[reProductName] := E_SProductName.text;
- VersionInfo[reLegalTrademarks] := E_STrademark.text;
- VersionInfo[reIconFilename] := E_SIconFilename.text;
- SaveSettings(ChangeFileExt(FileName, '.VER'));
- end;
- end;
-
- procedure Tf_editversion.SetFileName(const Value: string);
- begin
- fFileName := Value;
- end;
-
- procedure Tf_editversion.setProjectName(const Value: string);
- begin
- fProjectName := Value;
- end;
-
- procedure Tf_editversion.FormCreate(Sender: TObject);
- begin
- RetrieveSettings;
- end;
-
- procedure Tf_editversion.BitBtn2Click(Sender: TObject);
- begin
- SaveSettings;
- end;
-
- procedure Tf_editversion.b_iconFileNameClick(Sender: TObject);
- begin
- with opendialog do begin
- if execute
- then case TbitBtn(sender).tag of
- 0 : E_IconFilename.text := filename;
- 1 : E_SIconFileName.text := filename;
- end;
- end;
- end;
-
- procedure Tf_editversion.E_majorKeyPress(Sender: TObject; var Key: Char);
- begin
- if not (key in ['0'..'9', #27, #8, #9, #13])
- then key := #0;
- end;
-
- procedure Tf_editversion.E_majorChange(Sender: TObject);
- begin
- If trim(Tedit(sender).Text) = ''
- then Tedit(sender).text := '0';
- end;
-
- procedure Tf_editversion.E_descriptionChange(Sender: TObject);
- var tmpsl : tstringlist;
- i : TResourceTypeEnum;
- begin
- tmpsl := tstringlist.create;
- with FBuilder.ResourceHandler do
- for i := low(i) to high(i) do
- tmpsl.add('');
-
- tmpsl[ord(reMajor)] := E_Major.text;
- tmpsl[ord(reMinor)] := E_Minor.text;
- tmpsl[ord(reRelease)] := E_Release.text;
- tmpsl[ord(reBuild)] := E_Build.text;
- tmpsl[ord(reAppID)] := E_AppID.text;
- tmpsl[ord(reProductMajor)] := E_ProductMajor.text;
- tmpsl[ord(reProductMinor)] := E_ProductMinor.text;
- tmpsl[ord(reProductRelease)] := E_ProductRelease.text;
- tmpsl[ord(reProductBuild)] := E_ProductBuild.text;
- tmpsl[ord(reCompany)] := E_Company.text;
- tmpsl[ord(reDescription)] := E_Description.text;
- tmpsl[ord(reComments)] := E_Comments.text;
- tmpsl[ord(reInternalName)] := E_InternalName.text;
- tmpsl[ord(reOriginalFilename)] := E_OriginalFilename.text;
- tmpsl[ord(reLegalCopyRight)] := E_CopyRight.text;
- tmpsl[ord(reProductName)] := E_ProductName.text;
- tmpsl[ord(reLegalTrademarks)] := E_Trademark.text;
- tmpsl[ord(reIconFilename)] := E_IconFilename.text;
-
- if (tmpsl[ord(reMajor)] = '0') or (tmpsl[ord(reMajor)] = '')
- then tmpsl[ord(reMajor)] := E_SMajor.text;
- if (tmpsl[ord(reMinor)] = '0') or (tmpsl[ord(reMinor)] = '')
- then tmpsl[ord(reMinor)] := E_SMinor.text;
- if (tmpsl[ord(reRelease)] = '0') or (tmpsl[ord(reRelease)] = '')
- then tmpsl[ord(reRelease)] := E_SRelease.text;
- if (tmpsl[ord(reBuild)] = '0') or (tmpsl[ord(reBuild)] = '')
- then tmpsl[ord(reBuild)] := E_SBuild.text;
- if (tmpsl[ord(reProductMajor)] = '0') or (tmpsl[ord(reProductMajor)] = '')
- then tmpsl[ord(reProductMajor)] := E_SProductMajor.text;
- if (tmpsl[ord(reProductMinor)] = '0') or (tmpsl[ord(reProductMinor)] = '')
- then tmpsl[ord(reProductMinor)] := E_SProductMinor.text;
- if (tmpsl[ord(reProductRelease)] = '0') or (tmpsl[ord(reProductRelease)] = '')
- then tmpsl[ord(reProductRelease)] := E_SProductRelease.text;
- if (tmpsl[ord(reProductBuild)] = '0') or (tmpsl[ord(reProductBuild)] = '')
- then tmpsl[ord(reProductBuild)] := E_SProductBuild.text;
- if (tmpsl[ord(reAppId)] = '0') or (tmpsl[ord(reAppId)] = '')
- then tmpsl[ord(reAppId)] := E_SAppId.text;
- if tmpsl[ord(reDescription)] = ''
- then tmpsl[ord(reDescription)] := E_SDescription.text;
- if tmpsl[ord(reComments)] = ''
- then tmpsl[ord(reComments)] := E_SComments.text;
- if tmpsl[ord(reCompany)] = ''
- then tmpsl[ord(reCompany)] := E_SCompany.text;
- if tmpsl[ord(reInternalName)] = ''
- then tmpsl[ord(reInternalName)] := E_SInternalName.text;
- if tmpsl[ord(reOriginalFileName)] = ''
- then tmpsl[ord(reOriginalFileName)] := E_SOriginalFileName.text;
- if tmpsl[ord(reLegalCopyright)] = ''
- then tmpsl[ord(reLegalCopyright)] := E_SCopyright.text;
- if tmpsl[ord(reLegalTrademarks)] = ''
- then tmpsl[ord(reLegalTrademarks)] := E_STrademark.text;
- if tmpsl[ord(reProductName)] = ''
- then tmpsl[ord(reProductName)] := E_SProductName.text;
- if tmpsl[ord(reIconFilename)] = ''
- then tmpsl[ord(reIconFilename)] := E_SIconFilename.text;
- m_merge.lines.clear;
- m_merge.lines.add('Produces the following version information for');
- m_merge.lines.add(f_mainForm.MakeEllipsisFilename(filename, m_merge.width, self.Canvas));
- m_merge.lines.add('');
- m_merge.lines.add('File Version = '+tmpsl[ord(reMajor)]+'.'+tmpsl[ord(reMinor)]+'.'+
- tmpsl[ord(reRelease)]+'.'+tmpsl[ord(reBuild)]);
- m_merge.lines.add('Product Version = '+tmpsl[ord(reProductMajor)]+'.'+tmpsl[ord(reProductMinor)]+'.'+
- tmpsl[ord(reProductRelease)]+'.'+tmpsl[ord(reProductBuild)]);
- with FBuilder.ResourceHandler do
- for i := reAppid to reIconFileName do
- m_merge.lines.add(ResourceName[i]+' = '+tmpsl[ord(i)]);
- end;
-
- end.
-